package 一六;

import java.util.Scanner;

/**
 * Created by lenovo on 2017/3/14.
 */
public class q8 {

    /**
     * 判断余数是否满足条件
     * @param dd
     * @return
     */
    private static Boolean check(int dd){
        double d = Math.floor(Math.sqrt(dd));
        return d * d == dd?Boolean.TRUE:Boolean.FALSE;
    }
    public static void main(String[] args){

        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.nextLine();

        for(int i=0;i<Math.sqrt(n);i++){
            for(int j =i;j<Math.sqrt(n);j++){
                for(int k = j;k<Math.sqrt(n);k++){
                   int dd = n - i*i - j*j - k*k;
                    int d = (int)(Math.sqrt(dd));
                    if(q8.check(dd)&&d>=k){
                        System.out.println(i + " " + j + " " + k +" " + d);
                        return;
                    }
                }
            }
        }
    }
}
